package cn.wjssl.test.domain;

import cn.wjssl.domain.rebate.model.entity.BehaviorEntity;
import cn.wjssl.domain.rebate.model.valobj.BehaviorTypeVO;
import cn.wjssl.domain.rebate.service.IBehaviorRebateService;
import com.alibaba.fastjson2.JSON;
import lombok.extern.slf4j.Slf4j;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

import javax.annotation.Resource;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

@Slf4j
@RunWith(SpringRunner.class)
@SpringBootTest
public class RebateTest {

    private final SimpleDateFormat dateFormatDay = new SimpleDateFormat("yyyyMMdd");

    @Resource
    private IBehaviorRebateService rebateService;

    @Test
    public void test() {

        BehaviorEntity behaviorEntity = new BehaviorEntity();
        behaviorEntity.setUserId("lxd");
        behaviorEntity.setBehaviorTypeVO(BehaviorTypeVO.SIGN);
        behaviorEntity.setOutBusinessNo(dateFormatDay.format(new Date()));

        List<String> orderIds = rebateService.createBehaviorRebateOrder(behaviorEntity);
        log.info("请求参数：{}", JSON.toJSONString(behaviorEntity));
        log.info("测试结果：{}", JSON.toJSONString(orderIds));
    }
}
